package de.karlNet.sambamanager.ldapController.commands;

import java.io.UnsupportedEncodingException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.stereotype.Controller;

import de.karlNet.sambamanager.ldapController.commands.attributeBuilder.UserAttributeBuilder;
import de.karlNet.sambamanager.ldapModel.LdapUser;

@Controller
@Scope(value = "session", proxyMode = ScopedProxyMode.TARGET_CLASS)
public class CreateUser extends BaseCommand {
	@Autowired
	private UserAttributeBuilder userAttributeBuilder;

	public void createUserItself(LdapUser ldapUser)
			throws UnsupportedEncodingException {
		ldapTemplate.bind(ldapUser.getDn(), null,
				this.userAttributeBuilder.buildUserAttributes(ldapUser));
	}

}
